<internal>
Index
Classes
ReportType
constructor
initEnum()
closes the class. Then calling this constructor throws an exception.If your subclass has a constructor then you can control what properties are added to
this
via the argument you pass tosuper()
. No arguments are fine, too.Parameters
instanceProperties: any = ...
Provides initial properties.
Returns ReportType
optionalname
ordinal
staticCLASS
staticCLASS_METHOD
staticMODULE
staticMODULE_METHOD
staticNESTED_METHOD
staticPROJECT
staticenumValues
toString
Default
toString()
method for enum constant.Returns string
static[iterator]
Make enum classes iterable
Returns IterableIterator<default>
staticenumValueOf
Given the name of an enum constant, return its value.
Parameters
name: string
An enum name.
Returns default
staticinitEnum
Set up the enum, close the class.
Parameters
arg: any
Either an object whose properties provide the names and values (which must be mutable objects) of the enum constants. Or an Array whose elements are used as the names of the enum constants. The values are create by instantiating the current class.
Returns default
default
Provides several helper methods to work with method oriented data stored as this.aggregate
in ClassReport
/
ModuleReport
and directly in ClassMethodReport
/ ModuleMethodReport
.
constructor
If given assigns the method report to an internal variable. This is used by
ClassReport
andModuleReport
which stores aAggregateReport
respectively inthis.aggregate
. This is not set when AggregateReport uses this.Parameters
optionalaggregateReport: default
An AggregateReport to associate with this report.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
options: any = ...
(Optional) One or more optional parameters to pass to the formatter.
Returns string
default
Provides a wrapper around a data object hash which should contain an identifier
field and potentially a filter
field which is a function. The identifier can be a function or string or an array of functions / strings.
constructor
Initializes the Halstead trait.
Parameters
metric: string
The name of Halstead metric being stored.
data: any
The data field to be wrapped.
Returns default
metric
Returns the associated metric type.
Returns string
type
Returns the typeof data being wrapped.
Returns string
filter
Returns the value of the
filter
field of the wrapped data. If the wrappedfilter
field is a function it is invoked with the givenparams
otherwise the data is returned directly. Iffilter
is not defined thentrue
is returned.Parameters
rest...params: any
Provides parameters which are forwarded onto any data stored as a function. Normally
params
should be thecurrent AST node, parent AST node, ... optional data
.
Returns boolean
valueOf
Returns the value of the
identifier
field of the wrapped data. If the wrappedidentifier
field is a function it is invoked with the givenparams
otherwise the data is returned directly.Parameters
rest...params: any
Provides parameters which are forwarded onto any data stored as a function.
Returns any
default
Provides the class report object which stores data pertaining to a single ES6 class.
Methods that are stored as ClassMethodReport instances in the methods
member variable.
constructor
Initializes class report.
Parameters
optionalname: string
Name of the class.
optionalsuperClassName: string
Name of any associated super class.
lineStart: number = 0
Start line of class.
lineEnd: number = 0
End line of class.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
aggregateAverage
Stores the average class aggregate & method metric data.
errors
Stores any analysis errors.
lineEnd
Stores the end line for the class.
lineStart
Stores the start line for the class.
methodAverage
Stores the average method metric data.
methods
Stores all method data.
name
The name of the class.
superClassName
The name of any associated super class.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
type
Returns the enum for the report type.
Returns default
clearErrors
Clears all errors stored in the class report and by default any class methods.
Parameters
clearChildren: boolean = true
(Optional) If false then class method errors are not cleared; default (true).
Returns void
getErrors
Gets all errors stored in the class report and by default any class methods.
Parameters
options: { includeChildren: boolean; includeReports: boolean; query?: any } = ...
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns string
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
options: any = ...
(Optional) One or more optional parameters to pass to the formatter.
Returns string
staticgetFormats
Returns the supported transform formats.
Returns string[]
staticparse
Deserializes a JSON object representing a ClassReport.
Parameters
object: any
A JSON object of a ClassReport that was previously serialized.
Returns default
default
Provides the class method report object which stores data pertaining to a single method / function.
constructor
Initializes class module method report.
Parameters
optionalname: string
Name of the method.
optionalparamNames: string[]
Array of any associated parameter names.
optionallineStart: number
Start line of method.
optionallineEnd: number
End line of method.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
cyclomatic
The cyclomatic complexity of the method / report.
cyclomaticDensity
The cyclomatic density of the method.
errors
Stores any analysis errors.
halstead
Stores the Halstead data instance.
lineEnd
Stores the end line for the method.
lineStart
Stores the start line for the method.
maxNestedMethodDepth
Stores the max nested method depth.
name
The name of the method.
optionalnestedMethods
paramCount
The number of parameters for the method or aggregate report.
paramNames
Stores any parameter names.
sloc
The source lines of code for the method.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
type
Returns the enum for the report type.
Returns any
clearErrors
Clears all errors stored in the method report.
Parameters
clearChildren: boolean = true
(Optional) If false then nested method errors are not cleared; default (true).
Returns void
getErrors
Gets all errors stored in the method report and by default any nested methods.
Parameters
options: { includeChildren: boolean; includeReports: boolean; query?: any } = ...
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns string
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
options: any = ...
(Optional) One or more optional parameters to pass to the formatter.
Returns string
static_parse
Deserializes a JSON object representing a ClassMethodReport.
Parameters
targetObject: default | default
A target object to hydrate.
jsonObject: any
A JSON object of a class or module method report that was previously serialized.
Returns default | default
staticgetFormats
Returns the supported transform formats.
Returns any[]
staticparse
Deserializes a JSON object representing a ClassMethodReport.
Parameters
object: any
A JSON object of a ClassMethodReport that was previously serialized.
Returns default
default
Provides the module method report object which stores data pertaining to a single method / function.
constructor
Initializes module method report.
Parameters
optionalname: string
Name of the method.
optionalparamNames: string[]
Array of any associated parameter names.
optionallineStart: number
Start line of method.
optionallineEnd: number
End line of method.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
cyclomatic
The cyclomatic complexity of the method / report.
cyclomaticDensity
The cyclomatic density of the method.
errors
Stores any analysis errors.
halstead
Stores the Halstead data instance.
lineEnd
Stores the end line for the method.
lineStart
Stores the start line for the method.
maxNestedMethodDepth
Stores the max nested method depth.
name
The name of the method.
optionalnestedMethods
paramCount
The number of parameters for the method or aggregate report.
paramNames
Stores any parameter names.
sloc
The source lines of code for the method.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
type
Returns the enum for the report type.
Returns default
clearErrors
Clears all errors stored in the method report.
Parameters
clearChildren: boolean = true
(Optional) If false then nested method errors are not cleared; default (true).
Returns void
getErrors
Gets all errors stored in the method report and by default any nested methods.
Parameters
options: { includeChildren: boolean; includeReports: boolean; query?: any } = ...
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns string
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
options: any = ...
(Optional) One or more optional parameters to pass to the formatter.
Returns string
static_parse
Deserializes a JSON object representing a ClassMethodReport.
Parameters
targetObject: default | default
A target object to hydrate.
jsonObject: any
A JSON object of a class or module method report that was previously serialized.
Returns default | default
staticgetFormats
Returns the supported transform formats.
Returns string[]
staticparse
Deserializes a JSON object representing a ModuleMethodReport.
Parameters
object: any
A JSON object of a ModuleMethodReport that was previously serialized.
Returns default
default
Provides all the averaged module metric data.
constructor
Initializes the default averaged module data.
Returns default
maintainability
Measures the average method maintainability index for the module / file.
methodAverage
keys
Returns the object accessor list / keys for ModuleAverage.
Returns string[]
default
Provides all the averaged method metric data.
constructor
Returns default
cyclomatic
Measures the average method cyclomatic complexity of the module / class.
cyclomaticDensity
Measures the average method cyclomatic density of the module / class.
halstead
Stores the averaged Halstead metric data.
paramCount
Measures the average number of method parameters for the module / class.
sloc
Measures the average source lines of code for the module / class.
Type declaration
logical: number
physical: number
keys
Returns the object accessor list / keys for MethodAverage.
Returns string[]
default
Provides the aggregate report object which stores base data pertaining to a single method / function or cumulative aggregate data for a ModuleReport / ClassReport.
constructor
Initializes aggregate report.
Parameters
lineStart: number = 0
Start line of method.
lineEnd: number = 0
End line of method.
baseCyclomatic: number = 1
The initial base cyclomatic complexity of the report. Module and class reports start at 0.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
cyclomatic
The cyclomatic complexity of the method / report.
cyclomaticDensity
The cyclomatic density of the method.
halstead
Stores the Halstead data instance.
paramCount
The number of parameters for the method or aggregate report.
sloc
The source lines of code for the method.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
options: any = ...
(Optional) One or more optional parameters to pass to the formatter.
Returns string
default
Defines the output data from parsing an AST tree.
constructor
Initializes ASTData
Returns default
operands
operators
source
toString
Convert to string
Returns string
write
Appends a string.
Parameters
string: string
A string to append.
Returns void
default
This is an abstract class that is not intended to be used directly. Extend it to turn your class into an enum
(initialization is performed via MyClass.initEnum()
).
Modified from source provided by enumify (license unlisted / public domain)
constructor
initEnum()
closes the class. Then calling this constructor throws an exception.If your subclass has a constructor then you can control what properties are added to
this
via the argument you pass tosuper()
. No arguments are fine, too.Parameters
instanceProperties: any = ...
Provides initial properties.
Returns default
optionalname
ordinal
staticenumValues
toString
Default
toString()
method for enum constant.Returns string
static[iterator]
Make enum classes iterable
Returns IterableIterator<default>
staticenumValueOf
Given the name of an enum constant, return its value.
Parameters
name: string
An enum name.
Returns default
staticinitEnum
Set up the enum, close the class.
Parameters
arg: any
Either an object whose properties provide the names and values (which must be mutable objects) of the enum constants. Or an Array whose elements are used as the names of the enum constants. The values are create by instantiating the current class.
Returns default
default
Provides a wrapper for analysis errors stored in the errors
array for each report type.
constructor
lineEnd
Provides the line number where the error starts.
lineStart
Provides the line number where the error starts.
message
Provides the error message.
name
Attempt to find the name
then try srcPath
for modules.
severity
Provides the severity level.
type
Provides a type of report where the error is found.
toString
Returns a verbose string about the error.
Returns string
staticparse
Deserializes a JSON object representing a AnalyzeError.
Parameters
object: any
A JSON object of a AnalyzeError that was previously serialized.
Returns default
default
Provides a wrapper around a data field which may be an array, function or other primitive value.
constructor
Initializes trait data.
Parameters
metric: string
The name of Halstead metric being stored.
data: any
Data to wrap.
Returns default
metric
Returns the associated metric type.
Returns string
type
Returns the typeof data being wrapped.
Returns string | number | bigint | boolean | symbol | undefined | object | function
valueOf
Returns the value of the given data. If the wrapped data is a function it is invoked with the given
params
otherwise the data is returned directly. If the wrapped data is an array a mapped version is returned with each entry that is a function being invoked with the givenparams
.Parameters
rest...params: any[]
Provides parameters which are forwarded onto any data stored as a function. Normally
params
should be thecurrent AST node, parent AST node, ... optional data
.
Returns any
default
Provides the data / event passed to all invoked methods in PluginManager#invokeSyncEvent. The
event.data
field is returned to the caller. Before returning though additional the following additional metadata
is attached:
(number) $$plugin_invoke_count
- The count of plugins invoked.
(Array
$$plugin_invoke_names
- The names of plugins invoked.constructor
Initializes PluginEvent.
Parameters
optionalcopyProps: {}
Event data to copy.
optionalpassthruProps: {}
Event data to pass through.
optionalextraEventData: any
Extra event data attached to
extra
.
Returns default
data
Provides the unified event data assigning any pass through data to the copied data supplied.
eventbus
The active EventProxy for that particular plugin.
extra
Stores any extra event data added to all PluginEvents.
ignoreKeys
list of keys to ignore
pluginName
The active plugin name.
pluginOptions
The active plugin options.
projectReport
TODO: i don’t know where this is set, but it is used in excomplex-project/plugins
settings
settings for the plugin instance
syntaxes
All loaded trait syntaxes for AST nodes
default
Provides the method report object which stores data pertaining to a single method / function.
constructor
Initializes method report.
Parameters
name: string = ""
Name of the method.
paramNames: string[] = []
Array of any associated parameter names.
lineStart: number = 0
Start line of method.
lineEnd: number = 0
End line of method.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
cyclomatic
The cyclomatic complexity of the method / report.
cyclomaticDensity
The cyclomatic density of the method.
errors
Stores any analysis errors.
halstead
Stores the Halstead data instance.
lineEnd
Stores the end line for the method.
lineStart
Stores the start line for the method.
name
The name of the method.
optionalnestedMethods
paramCount
The number of parameters for the method or aggregate report.
paramNames
Stores any parameter names.
sloc
The source lines of code for the method.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
clearErrors
Clears all errors stored in the method report.
Parameters
clearChildren: boolean = true
(Optional) If false then nested method errors are not cleared; default (true).
Returns void
getErrors
Gets all errors stored in the method report and by default any nested methods.
Parameters
options: { includeChildren: boolean; includeReports: boolean; query?: any } = ...
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns string
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
options: any = ...
(Optional) One or more optional parameters to pass to the formatter.
Returns string
static_parse
Deserializes a JSON object representing a ClassMethodReport.
Parameters
targetObject: default | default
A target object to hydrate.
jsonObject: any
A JSON object of a class or module method report that was previously serialized.
Returns default | default
default
Provides all Halstead metric data / parameters.
constructor
Initializes the default Halstead data.
Returns default
bugs
Measures an estimate for the number of potential errors.
difficulty
Measures the difficulty of the program to write or understand.
effort
Measures the maintenance effort of the program.
length
Defines the number of operands and operators.
operands
In general an operand participates in actions associated with operators. A distinct and total count is provided with all identifiers.
Type declaration
distinct: number
identifiers: never[]
total: number
operators
In general an operator carries out an action. A distinct and total count is provided with all identifiers.
Type declaration
distinct: number
identifiers: never[]
total: number
time
Measures potential coding time.
vocabulary
Defines the unique number of operands and operators.
volume
Measures how much information a reader of the code potential has to absorb to understand its meaning.
reset
Resets the state of all Halstead data metrics without removing any operand or operator data.
Parameters
clearIdentifiers: boolean = false
Clears operands / operators; default: false.
Returns default
default
Provides all the averaged Halstead metric data.
constructor
Initializes the default Halstead data.
Returns default
bugs
Measures an estimate for the number of potential errors.
difficulty
Measures the difficulty of the program to write or understand.
effort
Measures the maintenance effort of the program.
length
Defines the number of operands and operators.
operands
In general an operand participates in actions associated with operators. A distinct and total count of identifiers.
Type declaration
distinct: number
total: number
operators
In general an operator carries out an action. A distinct and total count of identifiers.
Type declaration
distinct: number
total: number
time
Measures potential coding time.
vocabulary
Defines the unique number of operands and operators.
volume
Measures how much information a reader of the code potential has to absorb to understand its meaning.
default
Provides the default project report object which stores data pertaining to all modules / files contained.
All modules are stored in the modules
member variable as ModuleReports.
Various helper methods found in ModuleReport and AbstractReport help increment associated data during collection.
constructor
Initializes ProjectReport with default values.
Parameters
optionalmoduleReports: default[]
An array of ModuleReports for each module / file processed.
optionalsettings: { serializeModules: boolean } & {}
An object hash of the settings used in generating this report via ESComplexProject.
Returns default
adjacencyList
Stores a compacted form of the adjacency matrix. Each row index corresponds to the same report index. Each row entry corresponds to a report index. These relationships dictate the dependencies between all report ModuleReports given the source paths.
changeCost
Measures the average percentage of modules affected when one module / file in the project is changed. Lower is better.
coreSize
Measures the percentage of modules that are widely depended on which also depend on other modules. Lower is better.
errors
Stores any analysis errors.
firstOrderDensity
Measures the percentage of all possible internal dependencies that are actually realized in the project. Lower is better.
moduleAverage
Stores the average module metric data.
modules
Stores all ModuleReport data for the project sorted by the module / files srcPath
.
settings
Stores the settings used to generate the project report.
visibilityList
Stores a compacted form of the visibility matrix. Each row index corresponds to the same report index. Each row entry corresponds to a report index. These relationships dictate the reverse visibility between all report ModuleReports which may indirectly impact the given module / file.
type
Returns the enum for the report type.
Returns default
clearErrors
Clears all errors stored in the project report and by default any module reports.
Parameters
optionalclearChildren: boolean
(Optional) If false then class and module method errors are not cleared; default (true).
Returns void
finalize
Finalizes the ProjectReport. If
settings.serializeModules
is false output justfilePath
,srcPath
&srcPathAlias
entries of modules.Parameters
optionaloptions: { serializeModules: boolean }
(Optional) Allows overriding of ModuleReport serialization.
Returns default
getErrors
Gets all errors stored in the project report and by default any module reports.
Parameters
optionaloptions: { includeChildren: boolean; includeReports: boolean; query?: any }
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns any
getSetting
Returns the setting indexed by the given key.
Parameters
key: string
A key used to store the setting parameter.
optionaldefaultValue: any
A default value to return if no setting for the given key is currently stored.
Returns any
setSetting
Sets the setting indexed by the given key and returns true if successful.
Parameters
key: string
A key used to store the setting parameter.
value: any
A value to set to
this.settings[key]
.
Returns boolean
toFormat
Formats this ProjectReport given the type.
Parameters
name: string
The name of formatter to use.
optionaloptions: any
(Optional) One or more optional parameters to pass to the formatter.
Returns string
staticgetFormats
Returns the supported transform formats.
Returns string[]
staticparse
Deserializes a JSON object representing a ProjectReport.
Parameters
object: any
A JSON object of a ProjectReport that was previously serialized.
optionaloptions: { skipFinalize: boolean }
Optional parameters.
Returns default
default
Provides all the averaged module metric data.
constructor
Initializes the default averaged module data.
Returns default
maintainability
Measures the average method maintainability index for the module / file.
methodAverage
keys
Returns the object accessor list / keys for ModuleAverage.
Returns string[]
default
Provides the module report object which stores data pertaining to a single file / module being processed.
All ES Module classes are stored in the classes
member variable as ClassReports. Methods that are not part of a
class are stored as ModuleMethodReport instances in the methods
member variable.
Various helper methods found in ModuleReport and AbstractReport help increment associated data during collection.
constructor
Initializes the report.
Parameters
optionallineStart: number
Start line of file / module.
optionallineEnd: number
End line of file / module.
optionalsettings: any
An object hash of the settings used in generating this report via ESComplexModule.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
aggregateAverage
Stores the average module / class aggregate & method metric data.
classes
Stores all ClassReport data for the module.
dependencies
Stores all parsed dependencies.
errors
Stores any analysis errors.
filePath
Stores the file path of the module / file. The file path is only defined as supplied when processing projects.
lineEnd
Stores the end line for the module / file.
lineStart
Stores the start line for the module / file.
maintainability
Measures the average maintainability index for the module / file.
methodAverage
Stores just the average method metric data.
methods
Stores all module ModuleMethodReport data found outside of any ES6 classes.
settings
Stores the settings used to generate the module report.
srcPath
Stores the active source path of the module / file. This path is respective of how the file is referenced in
the source code itself. srcPath
is only defined as supplied when processing projects.
srcPathAlias
Stores the active source path alias of the module / file. This path is respective of how the file is
referenced in the source code itself when aliased including NPM and JSPM modules which provide a main
entry.
srcPathAlias
is only defined as supplied when processing projects.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
type
Returns the enum for the report type.
Returns default
clearErrors
Clears all errors stored in the module report and by default any class reports and module methods.
Parameters
optionalclearChildren: boolean
(Optional) If false then class and module method errors are not cleared; default (true).
Returns void
finalize
Cleans up any house keeping member variables.
Returns default
getErrors
Gets all errors stored in the module report and by default any module methods and class reports.
Parameters
optionaloptions: { includeChildren: boolean; includeReports: boolean; query?: any }
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns string
getSetting
Returns the setting indexed by the given key.
Parameters
key: string
A key used to store the setting parameter.
optionaldefaultValue: any
A default value to return if no setting for the given key is currently stored.
Returns any
setSetting
Sets the setting indexed by the given key and returns true if successful.
Parameters
key: string
A key used to store the setting parameter.
value: any
A value to set to
this.settings[key]
.
Returns boolean
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
optionaloptions: any
(Optional) One or more optional parameters to pass to the formatter.
Returns string
staticgetFormats
Returns the supported transform formats.
Returns string[]
staticparse
Deserializes a JSON object representing a ModuleReport.
Parameters
object: any
A JSON object of a ModuleReport that was previously serialized.
Returns default
default
This is an abstract class that is not intended to be used directly. Extend it to turn your class into an enum
(initialization is performed via MyClass.initEnum()
).
Modified from source provided by enumify (license unlisted / public domain)
constructor
initEnum()
closes the class. Then calling this constructor throws an exception.If your subclass has a constructor then you can control what properties are added to
this
via the argument you pass tosuper()
. No arguments are fine, too.Parameters
optionalinstanceProperties: any
Provides initial properties.
Returns default
optionalname
ordinal
staticenumValues
toString
Default
toString()
method for enum constant.Returns string
static[iterator]
Make enum classes iterable
Returns IterableIterator<default>
staticenumValueOf
Given the name of an enum constant, return its value.
Parameters
name: string
An enum name.
Returns default
staticinitEnum
Set up the enum, close the class.
Parameters
arg: any
Either an object whose properties provide the names and values (which must be mutable objects) of the enum constants. Or an Array whose elements are used as the names of the enum constants. The values are create by instantiating the current class.
Returns default
default
Provides a wrapper for analysis errors stored in the errors
array for each report type.
constructor
Initializes an instance.
Parameters
optionalseverity: string
Provides the severity level.
optionalmessage: string
Provides the error message.
optionalsourceReport: default | default | default | default | default
The source report of the error.
Returns default
lineEnd
Provides the line number where the error starts.
lineStart
Provides the line number where the error starts.
message
Provides the error message.
name
Attempt to find the name
then try srcPath
for modules.
severity
Provides the severity level.
type
Provides a type of report where the error is found.
toString
Returns a verbose string about the error.
Returns string
staticparse
Deserializes a JSON object representing a AnalyzeError.
Parameters
object: any
A JSON object of a AnalyzeError that was previously serialized.
Returns default
default
Provides several helper methods to work with method oriented data stored as this.aggregate
in ClassReport
/
ModuleReport
and directly in ClassMethodReport
/ ModuleMethodReport
.
constructor
If given assigns the method report to an internal variable. This is used by
ClassReport
andModuleReport
which stores aAggregateReport
respectively inthis.aggregate
. This is not set when AggregateReport uses this.Parameters
optionalaggregateReport: default
An AggregateReport to associate with this report.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
optionaloptions: any
(Optional) One or more optional parameters to pass to the formatter.
Returns string
default
Provides all the averaged method metric data.
constructor
Returns default
cyclomatic
Measures the average method cyclomatic complexity of the module / class.
cyclomaticDensity
Measures the average method cyclomatic density of the module / class.
halstead
Stores the averaged Halstead metric data.
paramCount
Measures the average number of method parameters for the module / class.
sloc
Measures the average source lines of code for the module / class.
Type declaration
logical: number
physical: number
keys
Returns the object accessor list / keys for MethodAverage.
Returns string[]
default
Provides the class report object which stores data pertaining to a single ES6 class.
Methods that are stored as ClassMethodReport instances in the methods
member variable.
constructor
Initializes class report.
Parameters
optionalname: string
Name of the class.
optionalsuperClassName: string
Name of any associated super class.
optionallineStart: number
Start line of class.
optionallineEnd: number
End line of class.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
aggregateAverage
Stores the average class aggregate & method metric data.
errors
Stores any analysis errors.
lineEnd
Stores the end line for the class.
lineStart
Stores the start line for the class.
methodAverage
Stores the average method metric data.
methods
Stores all method data.
name
The name of the class.
superClassName
The name of any associated super class.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
type
Returns the enum for the report type.
Returns default
clearErrors
Clears all errors stored in the class report and by default any class methods.
Parameters
optionalclearChildren: boolean
(Optional) If false then class method errors are not cleared; default (true).
Returns void
getErrors
Gets all errors stored in the class report and by default any class methods.
Parameters
optionaloptions: { includeChildren: boolean; includeReports: boolean; query?: any }
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns string
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
optionaloptions: any
(Optional) One or more optional parameters to pass to the formatter.
Returns string
staticgetFormats
Returns the supported transform formats.
Returns string[]
staticparse
Deserializes a JSON object representing a ClassReport.
Parameters
object: any
A JSON object of a ClassReport that was previously serialized.
Returns default
default
Provides the module method report object which stores data pertaining to a single method / function.
constructor
Initializes module method report.
Parameters
optionalname: string
Name of the method.
optionalparamNames: string[]
Array of any associated parameter names.
optionallineStart: number
Start line of method.
optionallineEnd: number
End line of method.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
cyclomatic
The cyclomatic complexity of the method / report.
cyclomaticDensity
The cyclomatic density of the method.
errors
Stores any analysis errors.
halstead
Stores the Halstead data instance.
lineEnd
Stores the end line for the method.
lineStart
Stores the start line for the method.
maxNestedMethodDepth
Stores the max nested method depth.
name
The name of the method.
optionalnestedMethods
paramCount
The number of parameters for the method or aggregate report.
paramNames
Stores any parameter names.
sloc
The source lines of code for the method.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
type
Returns the enum for the report type.
Returns default
clearErrors
Clears all errors stored in the method report.
Parameters
optionalclearChildren: boolean
(Optional) If false then nested method errors are not cleared; default (true).
Returns void
getErrors
Gets all errors stored in the method report and by default any nested methods.
Parameters
optionaloptions: { includeChildren: boolean; includeReports: boolean; query?: any }
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns string
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
optionaloptions: any
(Optional) One or more optional parameters to pass to the formatter.
Returns string
static_parse
Deserializes a JSON object representing a ClassMethodReport.
Parameters
targetObject: default | default
A target object to hydrate.
jsonObject: any
A JSON object of a class or module method report that was previously serialized.
Returns default | default
staticgetFormats
Returns the supported transform formats.
Returns string[]
staticparse
Deserializes a JSON object representing a ModuleMethodReport.
Parameters
object: any
A JSON object of a ModuleMethodReport that was previously serialized.
Returns default
default
Provides the aggregate report object which stores base data pertaining to a single method / function or cumulative aggregate data for a ModuleReport / ClassReport.
constructor
Initializes aggregate report.
Parameters
optionallineStart: number
Start line of method.
optionallineEnd: number
End line of method.
optionalbaseCyclomatic: number
The initial base cyclomatic complexity of the report. Module and class reports start at 0.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
cyclomatic
The cyclomatic complexity of the method / report.
cyclomaticDensity
The cyclomatic density of the method.
halstead
Stores the Halstead data instance.
paramCount
The number of parameters for the method or aggregate report.
sloc
The source lines of code for the method.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
optionaloptions: any
(Optional) One or more optional parameters to pass to the formatter.
Returns string
default
Provides the class method report object which stores data pertaining to a single method / function.
constructor
Initializes class module method report.
Parameters
optionalname: string
Name of the method.
optionalparamNames: string[]
Array of any associated parameter names.
optionallineStart: number
Start line of method.
optionallineEnd: number
End line of method.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
cyclomatic
The cyclomatic complexity of the method / report.
cyclomaticDensity
The cyclomatic density of the method.
errors
Stores any analysis errors.
halstead
Stores the Halstead data instance.
lineEnd
Stores the end line for the method.
lineStart
Stores the start line for the method.
maxNestedMethodDepth
Stores the max nested method depth.
name
The name of the method.
optionalnestedMethods
paramCount
The number of parameters for the method or aggregate report.
paramNames
Stores any parameter names.
sloc
The source lines of code for the method.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
type
Returns the enum for the report type.
Returns any
clearErrors
Clears all errors stored in the method report.
Parameters
optionalclearChildren: boolean
(Optional) If false then nested method errors are not cleared; default (true).
Returns void
getErrors
Gets all errors stored in the method report and by default any nested methods.
Parameters
optionaloptions: { includeChildren: boolean; includeReports: boolean; query?: any }
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns string
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
optionaloptions: any
(Optional) One or more optional parameters to pass to the formatter.
Returns string
static_parse
Deserializes a JSON object representing a ClassMethodReport.
Parameters
targetObject: default | default
A target object to hydrate.
jsonObject: any
A JSON object of a class or module method report that was previously serialized.
Returns default | default
staticgetFormats
Returns the supported transform formats.
Returns any[]
staticparse
Deserializes a JSON object representing a ClassMethodReport.
Parameters
object: any
A JSON object of a ClassMethodReport that was previously serialized.
Returns default
default
Provides the method report object which stores data pertaining to a single method / function.
constructor
Initializes method report.
Parameters
optionalname: string
Name of the method.
optionalparamNames: string[]
Array of any associated parameter names.
optionallineStart: number
Start line of method.
optionallineEnd: number
End line of method.
Returns default
optionalaggregate
Stores any associated AggregateReport
.
cyclomatic
The cyclomatic complexity of the method / report.
cyclomaticDensity
The cyclomatic density of the method.
errors
Stores any analysis errors.
halstead
Stores the Halstead data instance.
lineEnd
Stores the end line for the method.
lineStart
Stores the start line for the method.
name
The name of the method.
optionalnestedMethods
paramCount
The number of parameters for the method or aggregate report.
paramNames
Stores any parameter names.
sloc
The source lines of code for the method.
aggregateReport
Returns the associated
AggregateReport
orthis
. Both ClassReport and ModuleReport have anaggregate
AggregateReport.Returns default
clearErrors
Clears all errors stored in the method report.
Parameters
optionalclearChildren: boolean
(Optional) If false then nested method errors are not cleared; default (true).
Returns void
getErrors
Gets all errors stored in the method report and by default any nested methods.
Parameters
optionaloptions: { includeChildren: boolean; includeReports: boolean; query?: any }
Optional parameters.
Returns (default | { error: default; source: string })[]
getName
Returns the name / id associated with this report.
Returns string
toFormat
Formats this report given the type.
Parameters
name: string
The name of formatter to use.
optionaloptions: any
(Optional) One or more optional parameters to pass to the formatter.
Returns string
static_parse
Deserializes a JSON object representing a ClassMethodReport.
Parameters
targetObject: default | default
A target object to hydrate.
jsonObject: any
A JSON object of a class or module method report that was previously serialized.
Returns default | default
default
Provides all the averaged Halstead metric data.
constructor
Initializes the default Halstead data.
Returns default
bugs
Measures an estimate for the number of potential errors.
difficulty
Measures the difficulty of the program to write or understand.
effort
Measures the maintenance effort of the program.
length
Defines the number of operands and operators.
operands
In general an operand participates in actions associated with operators. A distinct and total count of identifiers.
Type declaration
distinct: number
total: number
operators
In general an operator carries out an action. A distinct and total count of identifiers.
Type declaration
distinct: number
total: number
time
Measures potential coding time.
vocabulary
Defines the unique number of operands and operators.
volume
Measures how much information a reader of the code potential has to absorb to understand its meaning.
default
Provides all Halstead metric data / parameters.
constructor
Initializes the default Halstead data.
Returns default
bugs
Measures an estimate for the number of potential errors.
difficulty
Measures the difficulty of the program to write or understand.
effort
Measures the maintenance effort of the program.
length
Defines the number of operands and operators.
operands
In general an operand participates in actions associated with operators. A distinct and total count is provided with all identifiers.
Type declaration
distinct: number
identifiers: never[]
total: number
operators
In general an operator carries out an action. A distinct and total count is provided with all identifiers.
Type declaration
distinct: number
identifiers: never[]
total: number
time
Measures potential coding time.
vocabulary
Defines the unique number of operands and operators.
volume
Measures how much information a reader of the code potential has to absorb to understand its meaning.
reset
Resets the state of all Halstead data metrics without removing any operand or operator data.
Parameters
optionalclearIdentifiers: boolean
Clears operands / operators; default: false.
Returns default
Type Aliases
SLOC
Type declaration
logical: number
physical: number
SLOC
Type declaration
logical: number
physical: number
ValidateArrayOptions
Type declaration
optionalerror?: boolean
optionalexpected?: any
optionalmessage?: string
optionalrequired?: boolean
optionaltype?: string
Defines ReportType enum.